home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #2 / Monster Media No. 2 (Monster Media)(1994).ISO / wp / wopr60.zip / SETUP.MST < prev    next >
Text File  |  1994-02-27  |  8KB  |  244 lines

  1. '$DEFINE DEBUG  ''Define for script development/debugging
  2.  
  3. '$INCLUDE 'setupapi.inc'
  4. '$INCLUDE 'msdetect.inc'
  5.  
  6. '' This lets us add progman items
  7.  
  8. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  9.  
  10.  
  11.  
  12.  
  13. ''Dialog ID's
  14. CONST ASKQUIT       = 200
  15. CONST DESTPATH      = 300
  16. CONST EXITFAILURE   = 400
  17. CONST EXITQUIT      = 600
  18. CONST EXITSUCCESS   = 700
  19. CONST APPHELP       = 900
  20. CONST MODELESS      = 5000
  21. CONST BADPATH       = 6400
  22.  
  23.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  24.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  25.  
  26.     '' Display the logo bitmap
  27.     SetBitmap CUIDLL$, 1
  28.  
  29.     '' read the .INF file
  30.     szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  31.     ReadInfFile szInf$
  32.  
  33.     '' query user for location to install to
  34.     DEST$="c:\rats"   ''default destination
  35.  
  36. GETPATH:
  37.     SetSymbolValue "EditTextIn", DEST$
  38.     SetSymbolValue "EditFocus", "END"
  39. GETPATHL1:
  40.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  41.     DEST$       = GetSymbolValue("WordStartupDir")
  42.     DOTDEST$    = GetSymbolValue("EditTextOut")
  43.     WINBREAK$   = GetSymbolValue("WinBreakPath")
  44.     ADBOOK$     = GetSymbolValue("AdbkPath")
  45.  
  46.     IN_TBEDIT$   = GetSymbolValue("IN_TBEDIT") 
  47.     IN_WOPRFILE$ = GetSymbolValue("IN_WOPRFILE")
  48.     IN_SPELLER$  = GetSymbolValue("IN_SPELLER") 
  49.     IN_WINBREAK$ = GetSymbolValue("IN_WINBREAK")
  50.     IN_WOPR$     = GetSymbolValue("IN_WOPR")
  51.     IN_ADBK$     = GetSymbolValue("IN_ADBK")
  52.  
  53.     IF sz$ = "CONTINUE" THEN
  54.         IF IsDirWritable(DOTDEST$) = 0 THEN
  55.             GOSUB BADPATH
  56.             GOTO GETPATHL1
  57.         END IF
  58.         UIPop 1
  59.     ELSEIF sz$ = "REACTIVATE" THEN
  60.         GOTO GETPATHL1
  61.     ELSEIF sz$ = "BACK" THEN
  62.         GOTO GETPATHL1
  63.     ELSE
  64.         GOSUB ASKQUIT
  65.         GOTO GETPATH
  66.     END IF
  67.  
  68.  
  69.     '' specify which files from .INF file should get copied
  70.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  71.  
  72.     '' Get the applications 
  73.  
  74.     IF IN_TBEDIT$ = "Y" OR IN_WOPRFILE$ = "Y" OR IN_SPELLER$ = "Y" THEN
  75.       AddSectionFilesToCopyList "WOPR6DLL", SrcDir$, GetWindowsSysDir()
  76.     ENDIF
  77.  
  78.     IF IN_TBEDIT$ = "Y" THEN
  79.       AddSectionFilesToCopyList "WOPR6TBED",  SrcDir$, DEST$
  80.     ENDIF
  81.  
  82.     IF IN_WOPRFILE$ = "Y" THEN
  83.       AddSectionFilesToCopyList "WOPR6FILE",  SrcDir$, DEST$
  84.     ENDIF                                     
  85.  
  86.     IF IN_SPELLER$ = "Y" THEN
  87.       AddSectionFilesToCopyList "WOPR6SPELL", SrcDir$, DEST$
  88.     ENDIF
  89.  
  90.     IF IN_WINBREAK$ = "Y" THEN
  91.       AddSectionFilesToCopyList "WinBreak",   SrcDir$, WINBREAK$
  92.     ENDIF
  93.  
  94.     IF IN_ADBK$ = "Y" THEN
  95.       AddSectionFilesToCopyList "ADBOOK",   SrcDir$, ADBOOK$
  96.     ENDIF
  97.  
  98.     IF IN_WOPR$ = "Y" THEN
  99.       AddSectionFilesToCopyList "WOPR6-DOT",  SrcDir$, DOTDEST$
  100.       AddSectionFilesToCopyList "WOPR6-DLL",  SrcDir$, DOTDEST$
  101.       AddSectionFilesToCopyList "WOPR6-WLL",  SrcDir$, DEST$
  102.     ENDIF
  103.  
  104.     '' Get the support DLL's
  105.  
  106.     '' Clean out any old copies of the DLLs hanging around elsewhere
  107.     MakeListFromSectionFilename "filenames","WOPR6DLL"
  108.     nnames%=GetListLength("filenames")
  109.  
  110.     FOR cur%=1 to nnames% STEP 1
  111.  
  112.        f$=GetListItem("filenames",cur%)
  113.        win_exist%=DoesFileExist(GetWindowsDir()+f$,femExists)
  114.        sys_exist%=DoesFileExist(GetWindowsSysDir()+f$,femExists)
  115.        IF (win_exist%=1 AND sys_exist%<>1) THEN
  116.           ''copy to file from \windows dir to \windows\system
  117.           CopyFile GetWindowsDir()+f$,GetWindowsSysDir+f$,cnoNone,0
  118.           ''delete file from \windows dir
  119.           RemoveFile GetWindowsDir()+f$,cmoForce
  120.        ELSEIF (win_exist%=1 AND sys_exist%=1) THEN
  121.           win_ver$=GetVersionOfFile(GetWindowsDir()+f$)
  122.           sys_ver$=GetVersionOfFile(GetWindowsSysDir()+f$)
  123.           IF win_ver$>sys_ver$ THEN
  124.              ''copy to file from \windows dir to \windows\system
  125.              CopyFile GetWindowsDir()+f$,GetWindowsSysDir+f$,cnoNone,0
  126.              ''delete file from \windows dir
  127.              RemoveFile GetWindowsDir()+f$,cmoForce
  128.           END IF
  129.           IF win_ver$=sys_ver$ THEN
  130.              ''copy to file from \windows dir to \windows\system
  131.              CopyFile GetWindowsDir()+f$,GetWindowsSysDir+f$,cnoNone,0
  132.              ''delete file from \windows dir
  133.              RemoveFile GetWindowsDir()+f$,cmoForce
  134.           END IF
  135.           IF win_ver$<sys_ver$ THEN
  136.              ''delete file from \windows dir
  137.              RemoveFile GetWindowsDir()+f$,cmoForce
  138.           END IF
  139.        END IF
  140.     NEXT cur%
  141.  
  142.     '' Make sure there is available disk space
  143.     '' First param is just left as "extra", because we are not
  144.     '' expanding any existing files (i.e. adding a K or two to the 
  145.     '' WIN.INI file. If you use this, add an "Extra" symbol to
  146.     '' the symbol table created by AddListitem.
  147.     '' Second Parameter identifies a symbol table that the
  148.     '' GetCopyListCost function will create for how much space
  149.     '' is used by the files to be copied to hard disk.
  150.     '' Third Parameter identifies a symbol table that the
  151.     '' GetCopyListCost function will create to identify needed
  152.     '' disk space.
  153.  
  154.     lRetVal& = GetCopyListCost ( "Extra", "FileCost", "Needed" )
  155.  
  156.     IF lRetVal& > 0 THEN
  157.       i% = DoMsgBox ("Insufficient Disk Space", "Setup", 0 )
  158.       ClearCopyList
  159.       GOTO GETPATH '' Try another directory
  160.     END IF
  161.  
  162.     '' Display billboard. "FModelessDlgProc" is the default. The
  163.     '' last parameter is irrelevant as long as it is non-zero
  164.     '' this is because we only have one billboard.
  165.  
  166.     SetCopyGaugePosition 150, 120
  167.  
  168.     '' copy the files
  169.     CopyFilesInCopyList
  170.  
  171.     IF IN_WINBREAK$ = "Y" THEN
  172.       CreateProgmanItem "Startup", "WinBreak", MakePath(WINBREAK$,"winbreak.exe"), "", cmoOverwrite
  173.     ENDIF
  174.  
  175. QUIT:
  176.     ON ERROR GOTO ERRQUIT
  177.  
  178.     IF ERR = 0 THEN
  179.         dlg% = EXITSUCCESS
  180.     ELSEIF ERR = STFQUIT THEN
  181.         dlg% = EXITQUIT
  182.     ELSE
  183.         dlg% = EXITFAILURE
  184.     END IF
  185. QUITL1:
  186.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  187.     IF sz$ = "REACTIVATE" THEN
  188.         GOTO QUITL1
  189.     END IF
  190.     UIPop 1
  191.  
  192.     END
  193.  
  194. ERRQUIT:
  195.     i% = DoMsgBox("Setup sources were corrupted, call 555-1212!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  196.     END
  197.  
  198. BADPATH:
  199.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  200.     IF sz$ = "REACTIVATE" THEN
  201.         GOTO BADPATH
  202.     END IF
  203.     UIPop 1
  204.     RETURN
  205.  
  206. ASKQUIT:
  207.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  208.  
  209.     IF sz$ = "EXIT" THEN
  210.         UIPopAll
  211.         ERROR STFQUIT
  212.     ELSEIF sz$ = "REACTIVATE" THEN
  213.         GOTO ASKQUIT
  214.     ELSE
  215.         UIPop 1
  216.     END IF
  217.     RETURN
  218.  
  219. '*************************************************************************
  220. '**
  221. '** Purpose:
  222. '**     Appends a file name to the end of a directory path,
  223. '**     inserting a backslash character as needed.
  224. '** Arguments:
  225. '**     szDir$  - full directory path (with optional ending "\")
  226. '**     szFile$ - filename to append to directory
  227. '** Returns:
  228. '**     Resulting fully qualified path name.
  229. '*************************************************************************
  230. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  231.     IF szDir$ = "" THEN
  232.         MakePath = szFile$
  233.     ELSEIF szFile$ = "" THEN
  234.         MakePath = szDir$
  235.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  236.         MakePath = szDir$ + szFile$
  237.     ELSE
  238.         MakePath = szDir$ + "\" + szFile$
  239.     END IF
  240. END FUNCTION
  241.  
  242.  
  243.  
  244.